
<?php
 include("../../includes/global_files/tables.inc");
include(DOCINCLUDES."global_files/global_html.inc");
include(DOCINCLUDES."global_files/global_form.inc");//
include(DOCINCLUDES."global_files/global_report.inc");
include(DOCINCLUDES."global_files/global_functions.inc");
include(DOCINCLUDES."global_files/tables.inc");
include(DOCINCLUDES."global_files/global_pgsql.inc");
include(DOCINCLUDES."libraries/function_masters.inc");
$page=new cPage;
$page->header_path="../../";
$page->doHeaderHtml();
$form=new cForm();
$db=new cDatabase($company_id);
$report=new cReport();
$table_name=($_GET['table'])?($_GET['table']):'_mcurrency';
if($_POST)
{



}

echo $form->startForm();

$master_tables=array("country"=>"_mcountry","currency"=>"_mcurrency
","shipmode"=>"_mship_mode
","city"=>"_mcity","buyer"=>"_jbuyer","account"=>"jaccount",
"ccontat"=>"company_contact","port"=>"_mairport");

$db->query="Select * from $table_name";
$db->runQuery();
$account_array=$db->returnArrays();

$db->query="Select * from information_schema.columns where 
table_name='$table_name' and table_schema='$company_id'";
$db->runQuery();
$tables_details_array=$db->returnArrays();

foreach($tables_details_array as $key=>$value)
{

$column_name=$value['column_name'];
$col_check=explode("_",$column_name);
$count_part=count($col_check);
if($col_check[$count_part]!="id")
{
// $post_value='$_POST[\''.$column.'\']';
$form->properties =
array("name"=>$column_name,"value"=>$_POST["$column_name"],
"size"=>"30" , "maxlength"=>"50","class"=>"textm");
	$move_stock_data[0][$column_name]= $form->generateInputTag();
}
}

// $form->properties=array("name"=>"location_id");
// $form->select_tag_properties=array("default"=>$default_location[0][
// "prd_partner_jid"],"arrays"=>$account_array,"restore_default"=>$_POST[
// "location_id"]);
// 	$move_stock_data[0]["Location To"]=$form->generateSelectTag(2);


	$report->data=$tables_details_array;
	$report->customization["table_style"]="width:50%;
	backcolour:white;border-style:none; border-width:none;
	border-collapse:collapse";
	$report->customization["tr_style"]="border-style:none;
	border-width:thin; border-collapse:collapse";
	$report->customization["column_style"][""]="text-align:left";
	$report->title="Enter Details";
	$report->highlight=true;

        $report->doVerticalTable();

	$report->data=$move_stock_data;
	$report->customization["table_style"]="width:50%;
	backcolour:white;border-style:none; border-width:none;
	border-collapse:collapse";
	$report->customization["tr_style"]="border-style:none;
	border-width:thin; border-collapse:collapse";
	$report->customization["column_style"][""]="text-align:left";
	$report->title="Enter Details";
	$report->highlight=true;

        $report->doVerticalTable();
echo $form->endForm();
$page->doFooterHtml();
?>

 <script type="text/Javascript">
  
function seekEntry(needle_e)
   { 
   var hay_stock;
   var needle=document.master.elements[needle_e].value;
   var avail=0;
	<?php
	echo " var hay_stock_string = \"$search_string\";";
	?>
   hay_stock = hay_stock_string.split(",");
   for(i=0;i<hay_stock.length;i++)
   {
   if(hay_stock[i]==needle) 
   {
   alert('This value already Exists!!!');
   avail++;
   break;
   }
   }
   if(avail==0 && needle.value!='') 
   alert('Congrats! This value is new.'); 
   }
   
  </script>

